/*
 * CheckBoxDelegate.cpp  0.4.0 / Dec 04, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#include "CheckBoxDelegate.h"

#include "QCheckBoxAdapter.h"

// CheckBoxDelegate :: Protected Constructor. ----------------------------------

/*!
 * \brief Constructs new CheckBoxDelegate object.
 *
 * \param env the JNIEnv pointer
 * \param obj the CheckBox java object
 */
CheckBoxDelegate::CheckBoxDelegate(JNIEnv *env, jobject obj)
  : ToggleButtonDelegate(env, obj, new QCheckBoxAdapter())
{
  // empty constructor body
}

// CheckBoxDelegate :: Static Native Calls. ------------------------------------

/*!
 * \brief Returns new instance of the delegate object
 *
 * \param env the JNIEnv pointer
 * \param obj the CheckBox java object
 * 
 * \return new instance of the delegate object
 */
jlong CheckBoxDelegate::newInstance(JNIEnv *env, jobject obj)
{
  if (JNISwingWrapper::isSwingThread(env)) {
    return reinterpret_cast<jlong>(new CheckBoxDelegate(env, obj));
  }
  return SwingUtilitiesDelegate::invokeLongAndWait(env, obj, createMID());
}
